-
Notifications
You must be signed in to change notification settings - Fork 259
fix normalization of python_full_version markers with pre-release versions
#893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideReplace manual text padding in nested marker creation with direct dataclass manipulation and rely on version str; make PEP440Version.text init=False to enforce normalization via to_string and remove parser text assignment; update tests to expect the new normalized version texts and adjusted markers. Class diagram for updated PEP440Version and Release handlingclassDiagram
class PEP440Version {
+Release release
+ReleaseTag pre
+ReleaseTag post
+ReleaseTag dev
+LocalSegmentType local
-str text (init=False)
-tuple _compare_key (init=False)
+__post_init__()
+to_string()
+_make_compare_key()
}
class Release {
+int major
+int minor
+int patch
}
PEP440Version --> Release : release
PEP440Version --> ReleaseTag : pre
PEP440Version --> ReleaseTag : post
PEP440Version --> ReleaseTag : dev
PEP440Version --> LocalSegmentType : local
Class diagram for create_nested_marker changesclassDiagram
class create_nested_marker {
+constraint
+version
+min_name
+op
+part
}
class Release {
+major
+minor
+patch
}
class Version {
+release
+stable
+__str__()
}
create_nested_marker --> Version : version
Version --> Release : release
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `tests/constraints/version/test_parse_constraint.py:456` </location>
<code_context>
+ ("^0-alpha.1", ">=0a1,<1"),
+ ("^0.1-alpha.1", ">=0.1a1,<0.2"),
+ ("^0.0.2-alpha.1", ">=0.0.2a1,<0.0.3"),
+ ("^0.1.2-alpha.1", ">=0.1.2a1,<0.2.0"),
("~1", ">=1,<2"),
("~1.0", ">=1.0,<1.1"),
</code_context>
<issue_to_address>
**suggestion (testing):** Missing test for normalization of post-release and dev-release constraints.
Please add tests for normalization of post-release (e.g., "1.0.0-post1") and dev-release (e.g., "1.0.0.dev1") constraints to cover these cases.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
python_full_version markers with pre-release versions
for more information, see https://pre-commit.ci
Resolves: python-poetry#10599
Replace the naive textual manipulation in
create_nested_markerwith direct manipulation of the objects, relying on their__str()__implementation to be good.To make sure that the
textfield is recalculated here, I made it aninit=Falsefield. That has the knock-on effect that we always normalize versions - which seems fine to me, probably a good thing.There is one testcase in poetry proper that will need a one-character tweak to expect the newly normalized version number.